package com.cloudtasks;
import com.cloudtasks.R;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnTouchListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;

/**
 * @author Administrator
 *
 */
public class AddMenuActivity extends Activity {
	
	final Context myContext = this;
	
	public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.tab_add_menu);
        
        // ADD BUTTON BY BROWSING
        Button addItemBB = (Button)findViewById(R.id.add_by_browsing_button);
        addItemBB.setOnClickListener(addUserByBrowsingListener);  
        // ADD BUTTON BY SEARCHING
        Button addItemBS = (Button)findViewById(R.id.add_by_searching_button);
        addItemBS.setOnClickListener(addUserBySearchingListener);  
        // ADD BUTTON CUSTOM
        Button addItemC = (Button)findViewById(R.id.add_custom_button);
        addItemC.setOnClickListener(addUserCustomListener);  
               
    }
	
	private OnClickListener addUserByBrowsingListener = new OnClickListener(){
		public void onClick(View v){						
			// fetch the name of the user				
			try{
				Intent intent = new Intent(myContext, AddItemByBrowsingPage1Activity.class);
				intent.putExtras(getIntent().getExtras());
				TabGroupActivity parentActivity = (TabGroupActivity)getParent();
				parentActivity.startChildActivity("AddItemByBrowsingPage1Activity", intent);
			}
			catch(Exception e){
				MyTools.displayToastMessage(myContext,e.toString());	
			}
		}
	};
	private OnClickListener addUserBySearchingListener = new OnClickListener(){
		public void onClick(View v){						
			// fetch the name of the user				
			try{
				Intent intent = new Intent(myContext, AddItemBySearchingActivity.class);
				intent.putExtras(getIntent().getExtras());
				TabGroupActivity parentActivity = (TabGroupActivity)getParent();
				parentActivity.startChildActivity("AddItemBySearchingActivity", intent);
			}
			catch(Exception e){
				MyTools.displayToastMessage(myContext,e.toString());	
			}
		}
	};
	private OnClickListener addUserCustomListener = new OnClickListener(){
		public void onClick(View v){						
			// fetch the name of the user				
			try{
				Intent intent = new Intent(myContext, AddItemCustomActivity.class);
				intent.putExtras(getIntent().getExtras());
				TabGroupActivity parentActivity = (TabGroupActivity)getParent();
				parentActivity.startChildActivity("AddItemCustomActivity", intent);
			}
			catch(Exception e){
				MyTools.displayToastMessage(myContext,e.toString());	
			}
		}
	};
	@Override
    public void onBackPressed() {
    // do something on back.
    	finish();
    return;
    }
}
